<?php defined('IN_IA') or exit('Access Denied');?><!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta http-equiv="Expires" content="-1" />
    <meta http-equiv="pragram" content="no-cache" />
    <title><?php  echo $app['appname'];?></title>
    <link rel="stylesheet" type="text/css" href="<?php echo MODULE_URL;?>static/app/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo MODULE_URL;?>static/app/css/animate.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo MODULE_URL;?>static/app/css/idangerous.swiper.css" />
<?php  foreach( $app['css'] as $cfile ): ?>
    <link rel="stylesheet" type="text/css" href="<?=$cfile?>">
<?php  endforeach; ?>
    <link rel="stylesheet" type="text/css" href="<?php echo MODULE_URL;?>static/app/css/units.css">
    <style type="text/css">
<?php  if($app['bgcolor']) { ?>
    .swiper-slide{ background-color:<?php  echo $app['bgcolor'];?>;}
<?php  } ?>
<?php  if($app['bgimage']) { ?>
    .app-content { background-image:url(<?php  echo tomedia($app['bgimage'])?>); background-size:100% auto; }
<?php  } ?>
    </style>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="<?php echo MODULE_URL;?>static/app/js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript">
    if (/Android (\d+\.\d+)/.test(navigator.userAgent)) {
        var version = parseFloat(RegExp.$1);
        if (version > 2.3) {
            var phoneScale = parseInt(window.screen.width) / 640;
            document.write('<meta name="viewport" content="width=640, minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
        }
        else {
            document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
        }
    }
    else {
        document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
    }
    $(function() {
        initSwiper();
        //end if jQuery 
        u = $(window).width(),
        a = $(window).height();
        $(document.body).css({
            overflow: "hidden",
            width: u,
            height: a,
            "max-height": a
        }), document.addEventListener("touchmove", function(e) {
            e.preventDefault()
        })
    })
    //参数1  设置横向、纵向拖动； 参数2 切换特效；参数3 是否自动播放首页动画
<?php  if($app['slidemethod']=='horizontal') { ?>
    var indexPage=1;
    function initSwiper(){
        initWOW(false,'<?php  echo $app['transition'];?>',true); 
    }
<?php  } else { ?>
    var indexPage=0;
    function initSwiper(){
        initWOW(true,'<?php  echo $app['transition'];?>',true);
    }
<?php  } ?>

    // jssdk config 对象
    jssdkconfig = <?php  echo json_encode($_W['account']['jssdkconfig']);?> || {};
    
    // 是否启用调试
    jssdkconfig.debug = false;
    
    jssdkconfig.jsApiList = [
        'checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'hideMenuItems',
        'showMenuItems',
        'hideAllNonBaseMenuItem',
        'showAllNonBaseMenuItem',
        'translateVoice',
        'startRecord',
        'stopRecord',
        'onRecordEnd',
        'playVoice',
        'pauseVoice',
        'stopVoice',
        'uploadVoice',
        'downloadVoice',
        'chooseImage',
        'previewImage',
        'uploadImage',
        'downloadImage',
        'getNetworkType',
        'openLocation',
        'getLocation',
        'hideOptionMenu',
        'showOptionMenu',
        'closeWindow',
        'scanQRCode',
        'chooseWXPay',
        'openProductSpecificView',
        'addCard',
        'chooseCard',
        'openCard'
    ];
    //微信去掉下方刷新栏 新规后不知道有用没，暂留着
    // if (navigator.userAgent.indexOf('MicroMessenger') >= 0) {
    //     document.addEventListener('WeixinJSBridgeReady', function() {
    //         WeixinJSBridge.call('hideToolbar');
    //     });
    // }
    </script>
</head>

<body data-appid="<?php  echo $app['id'];?>">
    <!--app loading-->
    <div id="app-loading">
    <?php  if($app['loading']=='app-loading-2') { ?>
      <div class="app-loading-2">
        <div class="bounce1"></div>
        <div class="bounce2"></div>
        <div class="bounce3"></div>
      </div>
    <?php  } else if($app['loading']=='app-loading-3') { ?>
      <div class="app-loading-3">
          <div class="spinner-container container1">
            <div class="circle1"></div>
            <div class="circle2"></div>
            <div class="circle3"></div>
            <div class="circle4"></div>
          </div>
          <div class="spinner-container container2">
            <div class="circle1"></div>
            <div class="circle2"></div>
            <div class="circle3"></div>
            <div class="circle4"></div>
          </div>
          <div class="spinner-container container3">
            <div class="circle1"></div>
            <div class="circle2"></div>
            <div class="circle3"></div>
            <div class="circle4"></div>
          </div>
     </div>
    <?php  } else if($app['loading']=='app-loading-4') { ?>
    <div class="progress app-loading-4">
        <div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%"> <span class="sr-only">45% Complete</span> </div>
    </div>
    <?php  } else { ?>
        <div class="app-loading-1">
            <div class="dot1"></div>
            <div class="dot2"></div>
        </div>
    <?php  } ?>
    </div>
    <!--app loading end-->
<?php  if($app['index_effect']=='yaoyy' && $app['index_imgurl']) { ?>
    <!--摇一摇效果-->
    <div class="cha-container" id="<?php  echo $app['index_effect'];?>">
        <div class="icon-shake-white">
            <p class="tiptext">摇一摇，开启精彩旅程...</p>
        </div>
        <img  src="<?php  echo tomedia($app['index_imgurl'])?>" />
    </div>
    <!--摇一摇效果结束--> 
<?php  } ?>
<?php  if($app['index_effect']=='cayc' && $app['index_imgurl']) { ?>
    <!--擦除效果-->
    <div class="cha-container" id="cayc"><div class="icon-cayc-white"><p class="tiptext">擦一擦，开启精彩旅程...</p></div><canvas id="chaCover"></canvas><img onLoad="initChaCover(this)" src="<?php  echo tomedia($app['index_imgurl'])?>" /></div>
    <!--擦除效果结束--> 
<?php  } ?>
    <!--app header-->
    <header class="app-header">
<?php  if($app['musicurl']) { ?>
        <a href="javascript:void(0);" class="u-globalAudio"><i class="icon-music"></i><audio src="<?php  echo tomedia($app['musicurl'])?>"<?php  if(empty($app['index_effect'])) { ?> autoplay="autoplay"<?php  } ?> loop></audio><span>开启</span></a>
<?php  } ?>
    </header>
    <!--app header end-->
    <!--app content-->
    <section class="swiper-container app-content">
        <section class="swiper-wrapper app-pages">
<?php  if(is_array($pagelist)) { foreach($pagelist as $page) { ?>
            <section class="swiper-slide page <?php  echo $page['pageclass'];?>">
<?php  if($app['transition']=='Flip') { ?>
<!-- 切换特效 翻转切换 -->
            <div class="flip-container">
<?php  } ?>
                <?php  if($page['background']) { ?><img class="background" src="<?php  echo tomedia($page['background'])?>"><?php  } ?>
                <?php  echo $page['content'];?>

<?php  if($app['slidemethod']=='horizontal') { ?>
                <!-- 横向切换 -->
                <a href="javascript:void(0);" class="u-guidehorizontal"></a>
<?php  } else { ?>
                <!-- 纵向切换 -->
                <a href="javascript:void(0);" class="u-guideTop z-move"></a>
<?php  } ?>
<?php  if($app['transition']=='Flip') { ?>
            </div>
<?php  } ?>
            </section>
<?php  } } ?>
            <!-- <section class="swiper-slide page music-info" style="background-color: #000;">
                <div class="music-info-hd text-center">
                    <img src="<?php echo MODULE_URL;?>static/app/img/pan.png" class="pan">
                </div>
                <div class="music-info-bd">
                    <p class="tit"><?php  echo $app['appname'];?></p>
                    <p><?php  echo $app['description'];?></p>
                </div>
                <div class="music-info-ft text-center">
                    <a href="http://mp.weixin.qq.com/s?__biz=MzAwNzI2MzE4OQ==&mid=202356775&idx=1&sn=0ff0d32302fda38b22eeed7b1d6fca92#wechat_redirect" class="btn btn-success"><i class="glyphicon glyphicon-music"></i> 听是谁在唱歌</a>
                    <a href="http://mp.weixin.qq.com/s?__biz=MzAwNzI2MzE4OQ==&mid=202356775&idx=1&sn=0ff0d32302fda38b22eeed7b1d6fca92#wechat_redirect" class="btn btn-success"><i class="glyphicon glyphicon-heart"></i> 推荐歌曲</a>
                </div>
            </section> -->
        </section>
    </section>
    <!--share maskLayer-->
    <div class="m-weixinShareLayer z-hide" style="display:none;"> <img src="<?php echo MODULE_URL;?>static/app/img/weixin-share-guide.png">
        <a href="javascript:void(0);" class="u-maskLayer-close"></a>
    </div>
    <!--share maskLayer end-->
    <!--share maskLayer2-->
    <div class="m-weixinShareLayer2 z-hide" style="display:none;"><img src="<?php echo MODULE_URL;?>static/app/img/weixin-share-guide2.png">
        <a href="javascript:void(0);" class="u-maskLayer-close"></a>
    </div>
    <!--share maskLayer2 end-->

    <div class="m-youkuVideoLayer z-hide" style="display:none;">
        <div class="m-youkuVideo" data-devid="80e261088f1a22ed"></div>
    </div>
    <!--listbox maskLayer-->
    <div class="m-listboxLayer z-hide" style="display:none;">
        <div class="m-listbox-detailListBox"></div>
        <a href="javascript:void(0);" class="u-guidePrev"></a>
        <a href="javascript:void(0);" class="u-guideNext"></a>
    </div>
    <!--app content-->
    <script src="<?php echo MODULE_URL;?>static/app/js/idangerous.swiper.js"></script>
    <script src="<?php echo MODULE_URL;?>static/app/js/idangerous.swiper.progress.js"></script>
    <script src="<?php echo MODULE_URL;?>static/app/js/wow.min.js"></script>
<?php  foreach( $app['script'] as $cfile ): ?>
    <script src="<?=$cfile?>"></script>
<?php  endforeach; ?>
    <script>
<?php
    $query_string = $_SERVER['QUERY_STRING'];
    //加上分享人的uid
    parse_str($query_string, $query_arr);
    $query_arr['u'] = $_W['member']['uid'];
    $query_string = http_build_query($query_arr);
    $_share['link'] = $_W['siteroot'].'app/index.php?'. $query_string;
    if($_W['member']['uid']){
        $_share['link']=$_share['link']."?uid=".$_W['member']['uid'];
    }
    $_share['imgUrl'] = tomedia($app['icon']);
?>
        wx.config(jssdkconfig);
        var sharedata = {
            'title':'<?php  echo $app['appname'];?>',
            'desc' :'<?php  echo $app['description'];?>',
            'link' :'<?php  echo $_share['link'];?>',
            'imgUrl' :'<?php  echo $_share['imgUrl'];?>'
        }
        // wx.ready(function () {
        //     wx.onMenuShareAppMessage(sharedata);
        //     wx.onMenuShareTimeline(sharedata);
        //     wx.onMenuShareQQ(sharedata);
        //     wx.onMenuShareWeibo(sharedata);
        //     wx.hideAllNonBaseMenuItem();
        //     // 要显示的菜单项
        //     wx.showMenuItems({
        //         menuList: [
        //             'menuItem:share:appMessage',
        //             'menuItem:share:timeline',
        //             'menuItem:share:qq',
        //             'menuItem:share:weiboApp',
        //             'menuItem:addContact',
        //             'menuItem:profile'
        //         ]
        //     });
        // });
        wx.ready(function () {
            wx.onMenuShareAppMessage(sharedata);
            wx.onMenuShareTimeline(sharedata);
            wx.onMenuShareQQ(sharedata);
            wx.onMenuShareWeibo(sharedata);
        });
    </script>
    <script src="<?php echo MODULE_URL;?>static/app/js/maskLayer.js"></script>
    <div class="hide"><?php  echo $_W['setting']['copyright']['statcode'];?></div>
</body>
</html>